package com.hsq.ndmall.wx.feign.factory;

import com.hsq.ndmall.common.utils.R;
import com.hsq.ndmall.wx.feign.index.PromotionFeign;
import feign.hystrix.FallbackFactory;

import java.util.HashMap;
import java.util.Map;

/**
 * @author 黄四清
 * @version 1.0.0
 * @ClassName PromotionFallbackFactory.java
 * @Description TODO
 * @createTime 2021年08月12日 20:53:00
 */
public class PromotionFallbackFactory implements FallbackFactory<PromotionFeign> {

    @Override
    public PromotionFeign create(Throwable throwable) {
        return new PromotionFeign() {
            @Override
            public R listBanner(Map<String, Object> params) {
                Map map = new HashMap();
                map.put("page", "id:0000,msg:请求失败,error:" + throwable.getMessage());
                return R.ok(map);
            }

            @Override
            public R listGroupon(Map<String, Object> params) {
                Map map = new HashMap();
                map.put("page", "id:0000,msg:请求失败,error:" + throwable.getMessage());
                return R.ok(map);
            }

            @Override
            public R listCoupon(Map<String, Object> params) {
                Map map = new HashMap();
                map.put("page", "id:0000,msg:请求失败,error:" + throwable.getMessage());
                return R.ok(map);
            }
        };
    }
}
